package com.smedi.ismedi.organization.core.port.adapter.service.impl;


import com.smedi.ismedi.notification.api.dto.request.SendSmsRequest;
import com.smedi.ismedi.notification.api.feign.RemoteSmsNotificationFeignApi;
import com.smedi.ismedi.organization.core.application.command.MessageSendCommand;
import com.smedi.ismedi.organization.core.port.adapter.convert.AdapterConverter;
import com.smedi.ismedi.organization.core.port.adapter.service.MessageRemoteService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * @author yangzhenzhou
 * @date 2022/9/6
 */
@Service
@AllArgsConstructor
public class MessageRemoteServiceImpl implements MessageRemoteService {
    private final RemoteSmsNotificationFeignApi remoteSmsNotificationFeignApi;
    private final AdapterConverter adapterConverter;
    @Override
    public void sendMessage(MessageSendCommand messageSendCommand) {
        SendSmsRequest sendSmsRequest = adapterConverter.messageSendCommandToSendSmsRequest(messageSendCommand);
        remoteSmsNotificationFeignApi.postSendShortMessage(sendSmsRequest);
    }
}
